package mystruct

import (
    "time"
    "go.mongodb.org/mongo-driver/bson/primitive"
)


const (
	StatusContinue             = 100 // RFC 9110, 15.2.1
	StatusSwitchingProtocols   = 101 // RFC 9110, 15.2.2
	StatusProcessing           = 102 // RFC 2518, 10.1
	StatusEarlyHints           = 103 // RFC 8297

	StatusOK                   = 200 // RFC 9110, 15.3.1
	StatusCreated              = 201 // RFC 9110, 15.3.2
	StatusAccepted             = 202 // RFC 9110, 15.3.3
	StatusNonAuthoritativeInfo = 203 // RFC 9110, 15.3.4
	StatusNoContent            = 204 // RFC 9110, 15.3.5
	StatusResetContent         = 205 // RFC 9110, 15.3.6
	StatusPartialContent       = 206 // RFC 9110, 15.3.7
	StatusMultiStatus          = 207 // RFC 4918, 11.1
	StatusAlreadyReported      = 208 // RFC 5842, 7.1
	StatusIMUsed               = 226 // RFC 3229, 10.4.1

	StatusMultipleChoices      = 300 // RFC 9110, 15.4.1
	StatusMovedPermanently     = 301 // RFC 9110, 15.4.2
	StatusFound                = 302 // RFC 9110, 15.4.3
	StatusSeeOther             = 303 // RFC 9110, 15.4.4
	StatusNotModified          = 304 // RFC 9110, 15.4.5
	StatusUseProxy             = 305 // RFC 9110, 15.4.6

	StatusTemporaryRedirect    = 307 // RFC 9110, 15.4.8
	StatusPermanentRedirect    = 308 // RFC 9110, 15.4.9

	StatusBadRequest                    = 400 // RFC 9110, 15.5.1
	StatusUnauthorized                  = 401 // RFC 9110, 15.5.2
	StatusPaymentRequired               = 402 // RFC 9110, 15.5.3
	StatusForbidden                     = 403 // RFC 9110, 15.5.4
	StatusNotFound                      = 404 // RFC 9110, 15.5.5
	StatusMethodNotAllowed              = 405 // RFC 9110, 15.5.6
	StatusNotAcceptable                 = 406 // RFC 9110, 15.5.7
	StatusProxyAuthRequired             = 407 // RFC 9110, 15.5.8
	StatusRequestTimeout                = 408 // RFC 9110, 15.5.9
	StatusConflict                      = 409 // RFC 9110, 15.5.10
	StatusGone                          = 410 // RFC 9110, 15.5.11
	StatusLengthRequired                = 411 // RFC 9110, 15.5.12
	StatusPreconditionFailed            = 412 // RFC 9110, 15.5.13
	StatusRequestEntityTooLarge         = 413 // RFC 9110, 15.5.14
	StatusRequestURITooLong             = 414 // RFC 9110, 15.5.15
	StatusUnsupportedMediaType          = 415 // RFC 9110, 15.5.16
	StatusRequestedRangeNotSatisfiable  = 416 // RFC 9110, 15.5.17
	StatusExpectationFailed             = 417 // RFC 9110, 15.5.18
	StatusTeapot                        = 418 // RFC 9110, 15.5.19 (Unused)
	StatusMisdirectedRequest            = 421 // RFC 9110, 15.5.20
	StatusUnprocessableEntity           = 422 // RFC 9110, 15.5.21
	StatusLocked                        = 423 // RFC 4918, 11.3
	StatusFailedDependency              = 424 // RFC 4918, 11.4
	StatusTooEarly                      = 425 // RFC 8470, 5.2.
	StatusUpgradeRequired               = 426 // RFC 9110, 15.5.22
	StatusPreconditionRequired          = 428 // RFC 6585, 3
	StatusTooManyRequests               = 429 // RFC 6585, 4
	StatusRequestHeaderFieldsTooLarge   = 431 // RFC 6585, 5
	StatusUnavailableForLegalReasons    = 451 // RFC 7725, 3

	StatusInternalServerError           = 500 // RFC 9110, 15.6.1
	StatusNotImplemented                = 501 // RFC 9110, 15.6.2
	StatusBadGateway                    = 502 // RFC 9110, 15.6.3
	StatusServiceUnavailable            = 503 // RFC 9110, 15.6.4
	StatusGatewayTimeout                = 504 // RFC 9110, 15.6.5
	StatusHTTPVersionNotSupported       = 505 // RFC 9110, 15.6.6
	StatusVariantAlsoNegotiates         = 506 // RFC 2295, 8.1
	StatusInsufficientStorage           = 507 // RFC 4918, 11.5
	StatusLoopDetected                  = 508 // RFC 5842, 7.2
	StatusNotExtended                   = 510 // RFC 2774, 7
	StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6
	MyCodeErr = 0
	MyCodeOk  = 1
	AUTH_ININUSER = 999			// 32 - 999 超管之上
	AUTH_Superadmin = 31  		// 22 - 31 超管
	AUTH_Administrator = 21 	// 12 - 21 管理
	AUTH_User = 11 				// 2 - 11 用户
	AUTH_Tourist = 1			// 0 - 1 游客
	PACK_CREATE_DIR  = "create_dir"
   	PACK_CREATE_FILE = "create_file"
   	PACK_DELETE_DIR  = "delete_dir"
   	PACK_DELETE_FILE = "delete_file"
   	PACK_UPLOAD_FILE = "upload_model"
   	PACK_ALL         = "all"
   	PACK_RENAME      = "rename"
)


type Map_data struct {
	Data 		map[string]interface{}
	AppendTime 	time.Time
}

type Retdate struct {
	Type 	string
	Code 	int64
	Mesg 	string
}

type Mypage struct {
	Limit   int64
	Page    int64
}


type Musercode struct {
	User 	Muser
	Gs      []string
	Time 	time.Time
}


type SearchItem struct {
	ID    		primitive.ObjectID 	`bson:"_id"`
	Data        primitive.M			`bson:"data"`
    AppendTime  time.Time          	`bson:"appendtime"`
}

type RequestData struct {
	Value []map[string]interface{} 	`json:"value" binding:"required"`
    Code  string  					`json:"code" binding:"required"`
}

//用户表
type Muser struct {
	Account  	string 	`json:"account" binding:"required"` // 账号
	Password 	string 	`json:"password"` 					// 密码
	Name	 	string 	`json:"name"` 						// 昵称
	Standing 	int64 	`json:"standing"` 					// 身份
	Createuser 	string 	`json:"create"` 					// 父对象
	Avatar		string 	`json:"avatar"`						// 头像
	Edit 		bool	`json:"edit"`						// 是否可编辑
	Authority 	map[string]Mroute 	`json:"authority"` 		// 权限
}

type Mroutes struct {
	Visitor Mroute 	`json:"visitor"`
	User 	Mroute 	`json:"user"`
	Root 	Mroute 	`json:"root"`
}

//权限
type Mroute struct {
	Add 	bool 	`json:"add"`
	Del 	bool 	`json:"del"`
	Set 	bool 	`json:"set"`
	See 	bool 	`json:"see"`
}

type ModelItems struct {
    Name   string 	`json:"name" binding:"required"`
    Value  string 	`json:"value" binding:"required"`
    Select string 	`json:"select" binding:"required"`
}

//api表
type ModelItem struct {
    Api   		string 	`json:"api" binding:"required"` 			// api
    Apiid 		string 	`json:"apiid" binding:"required"`
    Name  		string 	`json:"name" binding:"required"`
    Account 	string 	`json:"account" binding:"required"`
    Data  		[]ModelItems 	`json:"data" binding:"required"`
    Authority 	Mroutes `json:"authority"`
    Ipblacklist string 	`json:"ipblacklist"`
    Sort  		int64 	`json:"sort" binding:"required"`
}

// 所有弹幕结构体
type Barrage_All struct {
	Id 		string  		`json:"id" binding:"required"`
	Data    [][]interface{} `json:"data"`  
}

// 单挑弹幕结构体
type Barrage_One struct {
	Author  string 		`json:"author" binding:"required"`
	Color 	int64 		`json:"color" binding:"required"`
	Id 		string 		`json:"id" binding:"required"`
	Text    string 		`json:"text" binding:"required"`
	Time    float64 	`json:"time" binding:"required"`
	Type    int64 		`json:"type" binding:"required"`
}


type Mdata struct {
    Completed map[string][]string `json:"completed"`
}


type Mytoken struct {
	Key 			[]byte 		// aes秘钥, 可动态更新
	Sleeptime   	int64 		// 用户登录缓存检测时间
	Initcode 		string   	// 初始化秘钥用于创建初始化账号，每次启动刷新
	Port        	int64 		// 端口
	Log_Path 		string 		// 日志路径
	File_Path 	  	string 		// 特定上传文件路径
	Download_Path 	string 		// 存放路径
	Main_Path 	  	string 		// 程序启动路径
	Web_Path		string 		// web路径
}
